// Class 关键词

// function Person (name){
//     this.name = name
// }
// Person.prototype.say = function(){
//     console.log(`hi, my name is ${this.name}`)
// }

// class Person {
//     constructor(name){
//         this.name = name 
//     }
//     say(){
//         console.log(`hi, my name is ${this.name}`)
//     }
// }
// const p = new Person('liuchao')
// p.say()

// ----------------------------------------
// 静态方法 static
// class Person {
//     constructor(name){
//         this.name = name 
//     }
//     say(){
//         console.log(`hi, my name is ${this.name}`)
//     }
//     static create(name){
//         return new Person(name)
//     }
// }
// Person.create('liuchao').say()

// ----------------------------------------
// 类的继承 extends
class Person {
    constructor(name){
        this.name = name 
    }
    say(){
        console.log(`hi, my name is ${this.name}`)
    }
}

class Student extends Person {
    constructor(name, num){
        super(name)
        this.num = num
    }
    hello(){
        super.say()
        console.log(`my school number is ${this.name}`)
    }
}
const s = new Student('liuchao', 200)
s.hello()









